﻿@using Abp.Application.Services.Dto
@using MyCompanyName.AbpZeroTemplate.Authorization
@using MyCompanyName.AbpZeroTemplate.Web.Areas.AppAreaName.Models.Users
@using MyCompanyName.AbpZeroTemplate.Web.Areas.AppAreaName.Startup
@model UsersViewModel
@{
    ViewBag.CurrentPageName = AppAreaNamePageNames.Common.Users;
}
@section Styles
    {
    <link rel="stylesheet" abp-href="/view-resources/Areas/AppAreaName/Views/Users/Index.css" asp-append-version="true" />
}
@section Scripts
    {
    <script abp-src="/view-resources/Areas/AppAreaName/Views/_Bundles/user-list.js" asp-append-version="true"></script>
}
<div class="m-subheader">
    <div class="row align-items-center">
        <div class="mr-auto col-sm-12 col-md-6">
            <h3 class="m-subheader__title m-subheader__title--separator">
                <span>@L("Users")</span>
            </h3>
            <span class="m-section__sub">
                @L("UsersHeaderInfo")
            </span>
        </div>
        <div class="col-sm-12 col-md-6 text-right">
            <button id="ExportUsersToExcelButton" class="btn btn-outline-success"><i class="fa fa-file-excel-o"></i> @L("ExportToExcel")</button>
            @if (IsGranted(AppPermissions.Pages_Administration_Users_Create))
            {
                <button id="CreateNewUserButton" class="btn btn-primary"><i class="fa fa-plus"></i> @L("CreateNewUser")</button>
            }
        </div>
    </div>
</div>
<div class="m-content">
    <div class="m-portlet m-portlet--mobile">
        <div class="m-portlet__body">
            <div class="m-form m-form--label-align-right">
                <div class="row align-items-center m--margin-bottom-10">
                    <div class="col-xl-12">
                        <div class="form-group m-form__group align-items-center">
                            <div class="input-group">
                                <input type="text" id="UsersTableFilter" class="form-control m-input" placeholder="@L("SearchWithThreeDot")" value="@Model.FilterText">
                                <span class="input-group-btn">
                                    <button id="GetUsersButton" class="btn btn-primary" type="submit"><i class="flaticon-search-1" aria-label="@L("Search")"></i></button>
                                </span>
                            </div>
                        </div>
                    </div>
                </div>
                <div id="AdvacedAuditFiltersArea" style="display: none" class="row m--margin-bottom-10">
                    <div class="@(IsGranted(AppPermissions.Pages_Administration_Roles) ? "col-xl-6" : "col-xl-12")">
                        <div class="form-group">
                            @Html.DropDownList(
                                    "PermissionSelectionCombobox", Model.Permissions.Select(i => i.ToSelectListItem()),
                                    new
                                    {
                                        @class = "form-control selectpicker",
                                        data_live_search = "true",
                                        data_none_selected_text = L("FilterByPermission"),
                                        id = "PermissionSelectionCombo"
                                    })
                        </div>
                    </div>
                    @if (IsGranted(AppPermissions.Pages_Administration_Roles))
                    {
                        <div class="col-xl-6">
                            <div class="form-group">
                                @Html.DropDownList(
                                        "RoleSelectionCombobox", Model.Roles.Select(i => i.ToSelectListItem()),
                                        new
                                        {
                                            @class = "form-control selectpicker",
                                            data_live_search = "true",
                                            data_none_selected_text = L("FilterByRole"),
                                            id = "RoleSelectionCombo"
                                        })
                            </div>
                        </div>
                    }
                    <div class="col-xl-6">
                        <div class="m-checkbox-list">
                            <label class="m-checkbox">
                                <input type="checkbox"
                                       id="UsersTable_OnlyLockedUsers"
                                       name="OnlyLockedUsersCheckbox"
                                       value="true">
                                @L("OnlyLockedUsers")
                                <span></span>
                            </label>
                        </div>
                    </div>
                    <div class="col-xl-12 text-right">
                        <button id="RefreshUserListButton" class="btn btn-metal"><i class="fa fa-refresh"></i> @L("Refresh")</button>
                    </div>
                </div>
                <div class="row m--margin-bottom-10">
                    <div class="col-xl-12">
                        <span id="ShowAdvancedFiltersSpan" class="text-muted clickable-item"><i class="fa fa-angle-down"></i> @L("ShowAdvancedFilters")</span>
                        <span id="HideAdvancedFiltersSpan" class="text-muted clickable-item" style="display: none"><i class="fa fa-angle-up"></i> @L("HideAdvancedFilters")</span>
                    </div>
                </div>
            </div>
            <div class="row align-items-center">
                <table id="UsersTable" class="display table table-striped table-bordered table-hover dt-responsive nowrap">
                    <thead>
                        <tr>
                            <th></th>
                            <th>@L("Actions")</th>
                            <th>@L("UserName")</th>
                            <th>@L("Name")</th>
                            <th>@L("Surname")</th>
                            <th>@L("Roles")</th>
                            <th>@L("EmailAddress")</th>
                            <th>@L("EmailConfirm")</th>
                            <th>@L("Active")</th>
                            <th>@L("LastLoginTime")</th>
                            <th>@L("CreationTime")</th>
                        </tr>
                    </thead>
                </table>
            </div>

        </div>
    </div>
</div>